Skip to content

feat(agc-driver): execute boolean SET_PREDICATION - #742

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
alfalfa-star:feat/agc-driver-predication
Oct 5, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
alfalfa-star:feat/agc-driver-predication

Conversation

@alfalfa-star

Copy link
Copy Markdown
Contributor

What

The executor rejected SET_PREDICATION ("GPU query predication is not implemented") and every packet with the predicate header bit except the tag markers. PPSA14632 (LEGO Horizon Adventures) predicates an INDIRECT_BUFFER call on a 64-bit value its GPU work writes: sceAgcDcbSetPredication(condition 1, operation 3, wait 1, address), then sceAgcSetPacketPredication(call, 1) (#582), then operation 0.

  • SET_PREDICATION keeps the queue's predication, decoded as in Mesa's sid.h: operation 3 reads 64 bits, 4 reads 32 bits, bit 8 runs predicated packets when the value is non-zero (clear: when it is zero), bit 12 is a hint and is ignored, operation 0 clears it. Z-pass and primitive-count predication still throw, as do the continue bit and an address with its low 4 bits set (sceAgcDcbSetPredication writes it 16-byte aligned).
  • Predicated packets. The predicate bit is accepted on every packet but SET_PREDICATION and COND_EXEC. While predication is active, the executor records the queued labels and reads the value before the packet, as COND_EXEC (feat(agc): implement COND_EXEC #673) does, and skips the packet when the predicate fails, before any of its side effects. With predication cleared the packet runs, as on the command processor.
  • Predicated INDIRECT_BUFFER. Calls are inlined when a submission is copied, so a predicated call keeps its header in front of the inlined commands and records their end in conditionalEnds, like a COND_EXEC range. The whole block runs or is skipped on one evaluation. A predicated chain, a REWIND or flip or rendering wait inside a predicated call throw.

The assumptions are recorded in TechnicalDebt.

Tested

  • Arch Linux, GCC 16.2, Release, based on 823e01e3. agc_driver_pm4 now covers:
    • every operation and both polarities, 32- against 64-bit reads, and each rejection;
    • the predicate bit on draws and events;
    • an end-to-end submission in which a predicated WRITE_DATA and a predicated call to a nested buffer are skipped for a false predicate and run for a true one, plus the rejected predicated chain. With the copy change reverted it fails ("command buffer with a false predicate was executed").
  • Five existing checks used bit 0 as the example of an unsupported header flag (agc_driver_pm4, agc_driver). They now use a flag that is still unsupported for that packet.
  • Full ctest: 308/308 apart from the three wave64 pixel tests that fail on main on this GPU (RX 9070 XT, RADV).
  • PPSA14632 with feat(agc): implement packet and range predication and the predication sizes #582 and the title's other open fixes: the predicated submission runs, the Vulkan device is created and the title stops later at sceAgcDcbSetCxRegistersIndirect with a null address.
  • Windows not built or tested.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (complements feat(agc): implement packet and range predication and the predication sizes #582, which sets the predicate bit from libSceAgc)
  • AI-assisted: yes

🤖 Generated with Claude Code

SET_PREDICATION threw, and packets with the predicate header bit were
rejected. The executor now keeps the queue's predication: operations 3
and 4 read a 64- or 32-bit value and bit 8 selects whether predicated
packets run when it is non-zero or zero; operation 0 clears it. Before
a predicated packet runs while predication is active, queued labels are
recorded and the value is read, as for COND_EXEC; the packet is skipped
when the predicate fails.

Indirect buffers are inlined when a submission is copied, so a
predicated INDIRECT_BUFFER call keeps its header in front of the
inlined commands and records their end like a COND_EXEC range; the
block runs or is skipped on one evaluation, as on the command
processor. Query predication, a predicated COND_EXEC, predicated chains
and flips inside predicated command buffers throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#776 docs/dev/TechnicalDebt.md L42

@oneandonlydean
oneandonlydean merged commit 7887d88 into boykopovar:main Oct 5, 2026
4 of 6 checks passed
@alfalfa-star
alfalfa-star deleted the feat/agc-driver-predication branch October 7, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants